<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Advanced topics: thunarx Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
<link rel="home" href="index.html" title="thunarx Reference Manual">
<link rel="up" href="thunarx-writing-extensions.html" title="Part II. Writing Extensions">
<link rel="prev" href="thunarx-writing-extensions-getting-started.html" title="Getting Started">
<link rel="next" href="thunarx-fundamentals.html" title="Part III. Fundamentals">
<meta name="generator" content="GTK-Doc V1.33.1 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts"></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="thunarx-writing-extensions.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="thunarx-writing-extensions-getting-started.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="thunarx-fundamentals.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="sect1">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="thunarx-writing-extensions-advanced-topics"></a>Advanced topics</h2></div></div></div>
<p>
        This section provides a short introduction to some of the advanced topics in the
        Thunar Extension Framework.
      </p>
<div class="sect2">
<div class="titlepage"><div><div><h3 class="title">
<a name="thunarx-writing-extensions-memory-resident-extensions"></a>Memory-Resident Extensions</h3></div></div></div>
<p>
          Some extensions may not play well with Thunar's on-demand loading and unloading
          of extensions. For example, an extension that uses a desktop library, which in
          turn registers additional static GTypes will not work after being loaded and
          unloaded for the first time. For these kind of extensions, Thunar provides the
          option to make extensions <span class="emphasis"><em>memory resident</em></span>, which means the
          extension will be loaded once and afterwards will never be unloaded again until
          Thunar exits.
        </p>
<p>
          Such extensions must set the <code class="literal">resident</code> property of the provider plugin in its
          <code class="function">thunar_extension_initialize()</code> function to <code class="literal">TRUE</code>, using the <a class="link" href="ThunarxProviderPlugin.html#thunarx-provider-plugin-set-resident" title="thunarx_provider_plugin_set_resident ()"><code class="function">thunarx_provider_plugin_set_resident()</code></a>
          method.
        </p>
<div class="example">
<a name="id-1.3.5.3.4"></a><p class="title"><b>Example 2. Making an extension memory resident</b></p>
<div class="example-contents">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="n">G_MODULE_EXPORT</span><span class="w"> </span><span class="kt">void</span><span class="w"></span>
<span class="n">thunar_extension_initialize</span><span class="w"> </span><span class="p">(</span><span class="n">ThunarxProviderPlugin</span><span class="w"> </span><span class="o">*</span><span class="n">plugin</span><span class="p">)</span><span class="w"></span>
<span class="p">{</span><span class="w"></span>
<span class="w">  </span><span class="cm">/* setup the types for the extension */</span><span class="w"></span>
<span class="w">  </span><span class="p">...</span><span class="w"></span>

<span class="w">  </span><span class="cm">/* ensure that the extension will never be unloaded */</span><span class="w"></span>
<span class="w">  </span><span class="n">thunarx_provider_plugin_set_resident</span><span class="w"> </span><span class="p">(</span><span class="n">plugin</span><span class="p">,</span><span class="w"> </span><span class="n">TRUE</span><span class="p">);</span><span class="w"></span>
<span class="p">}</span><span class="w"></span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

</div>
<br class="example-break">
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.33.1</div>
</body>
</html>